﻿@{
    ViewBag.Title = "Add Item";
    ViewBag.ManageItemsActive = "active";
}
@if (TempData["Error"] != null)
{
    <div class="alert alert-error">
        @TempData["Error"]
    </div>
}

@if (TempData["Success"] != null)
{
    <div class="alert alert-success">
        @TempData["Success"]
    </div>
}
<h2>Add Item</h2>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span6 well">
            
            <form class="form-horizontal" method="POST" action="~/ManageItems/AddItem">
                <div class="control-group">
                    <label class="control-label" for="name">Name</label>
                    <div class="controls">
                        <input type="text" name="name" value="" pattern="[A-Za-z ]{1,20}" title="Only letters, 20 or less" required />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="Oprice">Original Price</label>
                    <div class="controls">
                        <input type="text" name="Oprice" value="" pattern="\d+(\.\d{2})?" title="0.00 format" required />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="percentDiscount">Percent Discount</label>
                    <div class="controls">
                        <input type="text" name="percentDiscount" value="" pattern="\d{1,3}" title="Numbers only three digits or less (ex. 100, 85, 31)" required />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="endTime">Ending Time</label>
                    <div class="controls">
                        <input type="text" name="endTime" value="@DateTime.Now.AddHours(3)" pattern="\d{1,2}\/\d{1,2}\/\d{4} \d{1,2}\:\d{2}(\:\d{2})? (AM|PM)" title="DD/MM/YYYY HH:MM PM/AM" required />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="description">Description</label>
                    <div class="controls">
                        <input type="text" name="description" value="" pattern=".{1,100}" title="Description 100 characters or less" required />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="photo">Photo URL</label>
                    <div class="controls">
                        <input type="text" name="photo" value="http://www.design.svetu.com/wp-content/gallery/clients/no_image.gif"/>
                    </div>
                </div>
                <div class="control-group">
                    
                    <select name="category" id="category">
                        <option selected="selected">Select a Category</option>
                        @foreach (var category in Model)
                        {
                            <option value="@category.Name">@category.Name</option>
                        }
                    </select>
                    @Html.ActionLink("Add a Category", "AddCategory", "ManageItems", new { @class = "btn btn-small btn-primary" })
   
                </div>
                <input type="submit" class="btn btn-primary" value="Save" />
            </form>
        </div>
    </div>
</div>
